import Axios from '../axios';
import { HttpResponse } from '../response';

import * as Index from './pc-params'
//add by sunbo 2021-09-08 添加PC端API接口
export class CzzyPCApi {
  /**
   *  生成报价单
   */
   addInvitation(params:any):Promise<HttpResponse<any>> {
    return Axios.post('/api/invitation/addInvitation',{
      expirationDate: '2021-08-04 00:00:00',
      ids: ["c5b4826db51542359283aecd2dfcb3e4"],
      suppliers: [{"id":"8aeec3a67ac8c4c7017acc76c61f11d7","phone":"18364227170","contacts":"","孙博":"","supplier":"孙博"}],
      }).then((res:any)=>{
        debugger;
        if (!res.data || res.errcode) {
          return 0;
        }
        return res.data.content
      })
  }
  /**
   * 批量处理待办
   */
  
  /**
   * 获取待阅
   */
  searchCirculates(params: Index.QueryAwaitParams):Promise<HttpResponse<any>> {
    return Axios.get('/api/runtime/workflow/search_circulates', {
      params
    });
  }

  /**
   * 获取已办
   */
  getFinishedWorkitems(params: Index.QueryParams):Promise<HttpResponse<any>> {
    return Axios.get('/api/runtime/workflow/list_finished_workitems', {
      params
    });
  }

  /**
   * 获取已阅
   */
  getFinishedCirculates(params: Index.QueryParams):Promise<HttpResponse<any>> {
    return Axios.get('/api/runtime/workflow/list_finished_circulates', {
      params
    });
  }

  /**
   * 标记为已阅
   */
  updateCirculateReaded(circulateItemIds: Array<string>):Promise<HttpResponse<any>> {
    return Axios.post('/api/runtime/workflow/update_circulate_readed', {
      circulateItemIds
    });
  }

  /**
   * 获取待办，待阅数量
   */
  getWorkCount(appCode:string = ''):Promise<HttpResponse<any>> {
    const params = {
      appCode
    };
    return Axios.get('/api/runtime/workflow/get_work_count', { params });
  }
};
